/*
 * File name: CCamera.h
 * Author:    Tom Krajnik
 */

#ifndef __CCAMERA_H__
#define __CCAMERA_H__

#include "CRawImage.h" 
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
extern "C" {
#include "v4l2uvc.h"
}


//-----------------------------------------------------------------------------
// Class CCamera
//-----------------------------------------------------------------------------
//! A CCamera class
/*! class to represent robot's camera
 */
class CCamera
{

	public:

	CCamera();
	int init(const char *deviceName);
	~CCamera();
	int renewImage(CRawImage* image);

	void setGain(int value);
	int getGain();

	void setExposition(int value);
	int getExposition();
	
	void setBrightness(int value);
	int getBrightness();
	int setDeviceAutoExposure(const bool val);

	private:
	int getDeviceGain();
	int getDeviceExposition();
	int getDeviceBrightness();

	int setDeviceExposition(const int value);
	int setDeviceGain(const int value);
	int setDeviceBrightness(const int value);
	int getParamInfo(const int paramType, int &min, int &max, int &default_val);
	

	CRawImage defaultImage;
	int exposition;
	int brightness;
	int gain;

	struct vdIn *videoIn;
	int width, height;
};
#endif
/* end of CCamera.h */
